package com.beans;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

/**
 * \* Created with IntelliJ IDEA.
 * \* User: Administrator
 * \* Date: 2022/7/17
 * \* Time: 23:12
 * \* To change this template use File | Settings | File Templates.
 * \* Description:
 * \
 */
@Controller
public class UserController2 {
    private UserService userService;
    @Autowired
    public UserController2(UserService userService){//进行构造方法的注入
        this.userService = userService;
    }

    //通过这个方法调用userService里面的方法
    public void sayHi(){
        userService.sayHi();
    }
}
